]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionSystem: Fix extension enabling/disabling order
authorKyrill Zorin <zorink@zoringroup.com>
Mon, 11 Aug 2025 22:42:36 +0000 (23:42 +0100)
committerMarge Bot <marge-bot@gnome.org>
Wed, 20 Aug 2025 12:37:53 +0000 (12:37 +0000)
Move disabling of unneeded extensions before enabling new ones
in _onEnabledExtensionsChanged(). Previously, conflicting
extensions could simultaneously be active briefly, leading to
unclean states, memory leaks, freezes, or crashes.

The old logic also caused unnecessary disable/enable cycles
for newly requested extensions, wasting resources. Running
the disable step first prevents these issues.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3835>

js/ui/extensionSystem.js

index 06f7d967fc58ab14db61e0b1bb041d077fe9197d..22121c4df2bde51508d7ec9d79e89aa64b3829f8 100644 (file)
@@ -571,16 +571,6 @@ export class ExtensionManager extends Signals.EventEmitter {
                 this.emit('extension-state-changed', extension);
         }
 
-        // Find and enable all the newly enabled extensions: UUIDs found in the
-        // new setting, but not in the old one.
-        const extensionsToEnable = newEnabledExtensions
-            .filter(uuid => !this._enabledExtensions.includes(uuid) &&
-                             this._extensionSupportsSessionMode(uuid));
-        for (const uuid of extensionsToEnable) {
-            // eslint-disable-next-line no-await-in-loop
-            await this._callExtensionEnable(uuid);
-        }
-
         // Find and disable all the newly disabled extensions: UUIDs found in the
         // old setting, but not in the new one.
         const extensionsToDisable = this._extensionOrder
@@ -594,6 +584,16 @@ export class ExtensionManager extends Signals.EventEmitter {
             await this._callExtensionDisable(uuid);
         }
 
+        // Find and enable all the newly enabled extensions: UUIDs found in the
+        // new setting, but not in the old one.
+        const extensionsToEnable = newEnabledExtensions
+            .filter(uuid => !this._enabledExtensions.includes(uuid) &&
+                             this._extensionSupportsSessionMode(uuid));
+        for (const uuid of extensionsToEnable) {
+            // eslint-disable-next-line no-await-in-loop
+            await this._callExtensionEnable(uuid);
+        }
+
         this._enabledExtensions = newEnabledExtensions;
     }